package 线程;

import org.junit.Test;
import sun.nio.ch.ThreadPool;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;

/**
 * @author:谢君臣
 * @Date:2021/8/18-15:47
 * @version:1.0
 * @function:
 */
public class TestThread1 {
    @Test
    public void test() throws ExecutionException, InterruptedException {
        FutureTask<String> futureTask = new FutureTask<String>(()->{return "asd";});
        futureTask.run();
        System.out.println(futureTask.get());

    }
    @Test
    public void test1(){
        ThreadLocal<Map<String,Object>> local = new ThreadLocal<>();
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("张三","sdafsdf");
        local.set(hashMap);
        Thread thread = Thread.currentThread();
    }
    @Test
    public void test2(){
        ThreadPool threadPool = (ThreadPool) Executors.newFixedThreadPool(10);

    }
}
